import { http } from "@/utils/http";

type PageItem = {
  size: number;
  total: number;
  records: Array<any>;
  current: number;
};

type PageResult = {
  code: number;
  success: boolean;
  msg: string;
  data: PageItem;
};

const baseUrl = "/api/tjpn4-handle-tally/app/";

export function GetTransportShipList(param?: any) {
  return http.request({
    url: baseUrl + "transport/shipList",
    method: "get",
    params: param
  });
}
export function GetTransportShipDetail(param?: any) {
  return http.request({
    url: baseUrl + "transport/shipDetail",
    method: "get",
    params: param
  });
}
export function GetTransportBillList(param?: any) {
  return http.request({
    url: baseUrl + "transport/billList",
    method: "get",
    params: param
  });
}
export function GetTransportBillDetail(param?: any) {
  return http.request({
    url: baseUrl + "transport/billDetail",
    method: "get",
    params: param
  });
}
export function GetPackageTypeList(param?: any) {
  return http.request({
    url: baseUrl + "transport/packageTypeList",
    method: "get",
    params: param
  });
}

export function GetShipCargoTypeList(param?: any) {
  return http.request({
    url: baseUrl + "transport/shipCargoTypeList",
    method: "get",
    params: param
  });
}

export function GetOperationProcessList(param?: any) {
  return http.request({
    url: baseUrl + "bd/operationProcess/list",
    method: "get",
    params: param
  });
}

export function GetTeamTree() {
  return http.request({
    url: baseUrl + "bd/team/tree",
    method: "get"
  });
}

export function SubmitOneStockTally(postData?: any) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "ost/appSubmit",
    method: "post",
    data: postData
  });
}

export function SubmitOneStockTallyBatch(postData?: any) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "ost/appSubmitBatch",
    method: "post",
    data: postData
  });
}

export function RemoveOneStockTally(id: string) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "ost/remove?id=" + id,
    method: "post"
  });
}

export function GetOneStockTallyHistory(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "ost/tallyHistory",
    method: "get",
    params: param
  });
}

export function SubmitTwoStockTally(postData?: any) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "tst/appSubmit",
    method: "post",
    data: postData
  });
}

export function RemoveTwoStockTally(id: string) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "tst/remove?id=" + id,
    method: "post"
  });
}

export function GetTwoStockTallyHistory(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "tst/tallyHistory",
    method: "get",
    params: param
  });
}

export function GetStorageByTransportBillId(param?: any): any {
  return http.request({
    url: baseUrl + "storage/getStorageByTransportBillId",
    method: "get",
    params: param
  });
}

export function GetStorageDetail(param?: any): any {
  return http.request({
    url: baseUrl + "storage/getStorageDetail",
    method: "get",
    params: param
  });
}

export function GetShipBillStorageList(param?: any): any {
  return http.request({
    url: baseUrl + "storage/shipBillStorageList",
    method: "get",
    params: param
  });
}

export function GetShipBillRemarkList(param?: any): any {
  return http.request({
    url: baseUrl + "tShipBillRemark/list",
    method: "get",
    params: param
  });
}

export function SubmitBulkTally(postData?: any) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "bt/appSubmit",
    method: "post",
    data: postData
  });
}

export function RemoveBulkTally(id: string) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "bt/remove?id=" + id,
    method: "post"
  });
}

export function GetBulkTallyHistory(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "bt/tallyHistory",
    method: "get",
    params: param
  });
}

export function GetShipArrange(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "transport/shipArrangeList",
    method: "get",
    params: param
  });
}

export function GetLandArrange(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "transport/landArrangeList",
    method: "get",
    params: param
  });
}

export function GetAssignWorker(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "transport/assignWorker",
    method: "get",
    params: param
  });
}

export function GetAssignMachineTree(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "transport/assignMachineTree",
    method: "get",
    params: param
  });
}

export function GetTallyMachineTree(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "tally/machineTree",
    method: "get",
    params: param
  });
}

export function SubmitRetreatSet(postData?: any) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "retreat/submit",
    method: "post",
    data: postData
  });
}

export function RemoveRetreatSet(id: string) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "retreat/remove?id=" + id,
    method: "post"
  });
}

export function GetRetreatSetHistory(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "retreat/retreatSetPage",
    method: "get",
    params: param
  });
}

export function GetRetreatTally(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "retreat/retreatTallyList",
    method: "get",
    params: param
  });
}

export function GetRetreatTotal(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "retreat/retreatTotal",
    method: "get",
    params: param
  });
}

export function SubmitGoodsPosition(postData?: any) {
  return http.request({
    headers: {
      "Content-Type": "application/json"
    },
    url: baseUrl + "goodsPosition/save",
    method: "post",
    data: postData
  });
}

export function GetGoodsPosition(param?: any): Promise<PageResult> {
  return http.request({
    url: baseUrl + "goodsPosition/getJsonData",
    method: "get",
    params: param
  });
}
